//
//  YXYSearchWebViewController.m
//  ';
//
//  Created by dllo on 15/12/15.
//  Copyright © 2015年 YXY. All rights reserved.
//

#import "YXYSearchWebViewController.h"

@interface YXYSearchWebViewController ()<UIWebViewDelegate>

@end

@implementation YXYSearchWebViewController
-(void)dealloc {
    [_url release];
    [super dealloc];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    [YXYNetWorkTool getWithUrl:self.url parameter:nil httpHeader:nil responseType:ResponseTypeJSON success:^(id result) {
        YXYSearchWebModel *searchWebModel = [[YXYSearchWebModel alloc] initWithDictionary:result[@"info"][@"sbj"]];
        dispatch_async(dispatch_get_main_queue(), ^{
            NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:searchWebModel.share[@"url"]]];
            UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, -58, self.view.width, self.view.height)];
            [webView loadRequest:request];
            webView.scalesPageToFit = YES;
            webView.delegate = self;
            [self.view addSubview:webView];
        });
    } fail:^(NSError *error) {
        
    }];
    

    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
